package com.zhang.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhang.pojo.OutputInfoBean;
import com.zhang.service.IOutputInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@Api(tags = "出库信息控制层接口")
@RestController
@RequestMapping("outputInfo")
public class OutputInfoController {

    @Autowired
    private IOutputInfoService  outputInfoService;


    @ApiOperation("根据客户名，起始、结束日期动态查询并分页")
    @GetMapping("findByPageAndItem")
    public IPage<OutputInfoBean> findByPageAndItem(int current,
                                                   int pageSize,
                                                   String name,
                                                   LocalDate start,
                                                   LocalDate end){
       return outputInfoService.findByPageAndItem(new Page<>(current,pageSize),name,start,end);
    }

    @ApiOperation("根据id查询出库信息和出库详情")
    @GetMapping("findById")
    public OutputInfoBean findById(int id){
        return outputInfoService.findByid(id);
    }

}
